#ifndef DOCTORFUNCTIONWIDGET_H
#define DOCTORFUNCTIONWIDGET_H

#include <QWidget>
#include"sidebar.h"
#include<QLabel>
#include<QPushButton>
#include<QLineEdit>
#include<QTableWidget>
#include<QStackedWidget>
//#include"../Login/editpersoninfotext.h"
#include"treatmentwidget.h"
#include<QDialog>
#include"../Tools/clienttcp.h"
#include <QTcpSocket>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include <QMessageBox>
#include<QTreeWidget>
#include"../Tools/clienttcp.h"
//#include<QTableWidget>
//#include<QStackedWidget>

class doctorFunctionWidget : public QWidget
{
    Q_OBJECT
public:
    explicit doctorFunctionWidget(int currentID, QString role,QWidget *parent = nullptr);
    ~doctorFunctionWidget();
private:
//    Sidebar *sidebar;
//    QPushButton *searchPushButton;
//    QLabel *searchLabel;
//    QLineEdit *searchLineEdit;
//    QTableWidget *appointmentTable;
//    QStackedWidget *stackedWidget;
//    //editPersonInfoText *editPersonInfo;
//    QTableWidget *caseTable; // 添加病例表单
//    treatmentWidget *treatmentPage; // 添加治疗页面
//    ClientTcp *tcp;
//    QLabel *titleLabel;
//        QLineEdit *usernameEdit;
//        QLineEdit *passwordEdit;
//        QLineEdit *nameEdit;
//        QLineEdit *ageEdit;
//        QLineEdit *genderEdit;
//        QLineEdit *phoneEdit;
//        QLineEdit *addressEdit;
//        QPushButton *registerButton;
//        QPushButton *loginButton;
//        QPushButton *exitButton;

    int currentID;
       QString role;

       QTreeWidget *sidebarMenu;
       QStackedWidget *stackedWidget;
       QLabel *searchLabel;
       QLineEdit *searchLineEdit;
       QPushButton *searchPushButton;
       QTableWidget *appointmentTable;
       QLineEdit *usernameEdit;
       QLineEdit *passwordEdit;
       QLineEdit *nameEdit;
       QLineEdit *genderEdit;
       QLineEdit *phoneEdit;
       QLineEdit *addressEdit;
       QPushButton *registerButton;
       QPushButton *exitButton;
       QTableWidget *caseTable;
       treatmentWidget *treatmentPage;
       ClientTcp *tcp;
       ClientTcp *tcp_APP;
       QLabel *avatarLabel;
       QLineEdit *specializationEdit;
       QLineEdit *departmentEdit;
       QLineEdit *titleEdit;
       QLineEdit *introductionEdit;
        QJsonObject doctorProfile; // 添加 doctorProfile 变量声明

           QWidget *prescriptionWidget;
           QLabel *patientNameLabel;
           QLabel *appointmentTimeLabel;
           QLabel *treatmentStatusLabel;
           QTextEdit *prescriptionTextEdit;
           QPushButton *savePrescriptionButton;



       QWidget* createAppointmentPage();
       QWidget* createProfilePage();
       QWidget* createCasesPage();
       QWidget* createCommunicationPage();

       void setDoctorProfile();
       void fetchDoctorProfile();
       void fetchAppointments();
private slots:
//    void onCurrentItemChanged(const int &index);
//    void onCaseItemClicked(int row, int column);
//    void onSearchClicked();
//    void onSaveClicked();
//        void onExitClicked();
       void onCurrentItemChanged(const int &index);
          void onCaseItemClicked(int row, int column);
          void onSearchClicked();
          void onSaveClicked();
//          void onExitClicked();
          void logout();
          void onAppointmentItemClicked(int,int);
          void onSavePrescriptionClicked();
signals:
void doctorLoggedOut();
};

#endif // DOCTORFUNCTIONWIDGET_H
